#ifndef __MQTT_PLATFORM_H
#define __MQTT_PLATFORM_H
#include "mqtt_cfg.h"
#include "mqtt.h"

#define DEBUG_RAW(TIP,CONTENT,LEN,CODE)   do						\
{																	\
	char *ptr=(char*)malloc(2*LEN+1);								\
	if(ptr!=NULL)													\
	{																\
		memset(ptr, 0, 2 * LEN + 1);								\
		hex2asc(CONTENT, LEN, ptr);									\
		printf("%s,message:%s,code:%d.\n", TIP, ptr, CODE);			\
		free(ptr);													\
	}																\
}while(0)
#define DEBUG_STRING(TIP,CONTENT)   do						\
{															\
	if(CONTENT!=NULL&&TIP!=NULL)							\
		printf("%s,message:%s.\n", TIP, CONTENT);			\
}while(0)
#define DEBUG_NUMBER(TIP,CONTENT)   do						\
{															\
	if(CONTENT!=0&&TIP!=0)							\
		printf("%s,message:%d.\n", TIP, CONTENT);			\
}while(0)
void mqtt_sem_init(MQTT * dev);
void mqtt_sem_post(MQTT* dev);
void mqtt_sem_wait(MQTT* dev);
int mqtt_socket_thread_delete(MQTT* dev);
int mqtt_socket_thread_init(MQTT_Socket_Type mqtt_socket_type, MQTT * dev, const char* ip, uint16_t port);
int hex2asc(const char* hex, int hex_len, char* asc);
void mqtt_subscribe_sem_init(void);
void mqtt_subscribe_sem_post(void);
void mqtt_subscribe_sem_wait(void);



#endif






